<?php 
return [
	'name' => '友情链接',
	'manager_url' => plugin_url('/link/admin/index'),
	'description' => '友情链接插件',
	'version' => '1.0.0',
	'author' => '谢蕾',
	'weburl' => 'http://www.ebcms.com/',
	'hooks'=>[
		'home_link' => [function(&$param){
			$view = new \mylib\View(\mylib\Config::get('view'));
			echo $view -> fetch(__DIR__ . '/tpl.php');
		}]
	],
	'install' => function(){
		$sqls = [];
		$sqls[] = "DROP TABLE IF EXISTS `ebcms_link`;";
		$sqls[] = <<<str
CREATE TABLE `ebcms_link` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '节点ID',
  `title` varchar(255) DEFAULT '' COMMENT '标题',
  `logo` varchar(255) DEFAULT '' COMMENT 'logo地址',
  `url` varchar(255) DEFAULT '' COMMENT '连接地址',
  `weight` tinyint(3) unsigned DEFAULT '0' COMMENT '排序',
  `remark` varchar(255) DEFAULT '' COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='友情链接';
str;
		$sqls[] = "INSERT INTO `ebcms_link` VALUES ('1', '易贝CMS', '', 'http://www.ebcms.com/', '1', '');";
		$sqls[] = "INSERT INTO `ebcms_link` VALUES ('2', '国外网站大全', '', 'http://www.kujiw.com/', '1', '');";
		foreach ($sqls as $sql) {
			$sql = str_replace('ebcms_', \mylib\Config::get('database.prefix'), $sql);
			\Ebcms::db() -> query($sql);
		}
		return true;
	},
	'uninstall' => function(){
		$sqls = [];
		$sqls[] = "DROP TABLE IF EXISTS `ebcms_link`;";
		foreach ($sqls as $sql) {
			$sql = str_replace('ebcms_', \mylib\Config::get('database.prefix'), $sql);
			\Ebcms::db() -> query($sql);
		}
		return true;
	}
];